﻿using System.Windows.Forms;
using ebc.coordinator.contract;
using ebc.portal.contract;
using ebc.worker.contract;

namespace ebc.board {
    class Board {

        private readonly IPortal portal = new portal.GUI();
        private readonly ICoordinator coordinator = new coordinator.Coordinator();
        private readonly IWorker worker = new worker.Worker();

        public Board() {
            portal.OnCoordinator += coordinator.ProcessCoordinatorRequest;
            coordinator.OnWorker += worker.ProcessWorkerRequest;
            worker.OnWorkerResult += coordinator.ProcessWorkerResult;
            coordinator.OnCoordinatorResult += portal.ShowResult;
        }

        public Form StartUp() {
            return portal as Form;
        }
    }
}
